$(document).ready(function() {    
				
				$('.HomeSubmitForm').click(function() {
                    jQuery.validator.setDefaults({                    
                      debug: true,
                      success: "valid"
                    });
                    $(".HomeFormText").validate({                        
                        rules: {    
							name: {
								required: true
							},
							phone: {
								required: true,
								number: true
							},
							email: {
								required: true,
								email: true
							},
							location: {
								required: true
							}
							// comment: {
								// required: true
							// }                                
						},
						 messages: {
							name: "",
							phone: "",
							email: "",
							location: ""
							// comment: ""
							 
						 }
							
                    });
					if ($(".HomeFormText").valid()) {  
						// $(".FormText").submit();
						Submit();
						 //alert('passValid')
					}
							
				});                   		
				
				function Submit() {
					$(".HomeFormText").submit(function() {										  
						var dataString = $(this).serialize();
						// console.log(dataString);
						$.ajax({
							type: "POST",
							url: "HomeMail.php",
							data: dataString,
							success: function(data){
								// console.log(data);
								// alert(data);
								
								// console.log('Show thank you message');
								$(".ContentPlaceHolder1_txtName").val('');
								$(".ContentPlaceHolder1_txtTelephon").val('');
								$(".ContentPlaceHolder1_txtEmail").val('');
								$(".ContentPlaceHolder1_txtLocation").val('');
								//$(".ContentPlaceHolder1_txtComment").val('');									 
								
							},
							cache: false		
						});
						return false;
					});
				}
			
											
					
});